package yang.VirtualMachine.chapter9.classStruct;

import java.io.IOException;
import java.io.InputStream;

import yang.VirtualMachine.chapter9.ClassBean;
import yang.VirtualMachine.chapter9.ClassUtil;
import yang.VirtualMachine.chapter9.Processer;

/**
 * 访问标记，按位
 * @author xinxin
 */
public class AccessFlagProcesser implements Processer {
	
	public static final int ACC_PUBLIC = 0x0001;// public 							0001
	public static final int ACC_FINAL = 0x0010;// final 					0001	0000
	public static final int ACC_SUPER = 0x0020;// 增强的方法调用父类  				0010 	0000
	public static final int ACC_INTERFACE = 0x0200; // 是否为接口 		0010 	0000 	0000
	public static final int ACC_ABSTRACT = 0x0400;// 是否为抽象类 		0100 	0000 	0000
	public static final int ACC_SYNTHETIC = 0x1000; // 由编译器产生的类，无源码对应	0001 0000 0000 0000
	public static final int ACC_ANNOTATION = 0x2000;// 是否是注释		0010 0000 0000 0000
	public static final int ACC_ENUM = 0x4000; // 是否是枚举			0100 0000 0000 0000

	@Override
	public void process(InputStream input) throws IOException {
		byte[] dest = new byte[2];
		input.read(dest);
		long l = ClassUtil.getNumByBytes(dest);
		
		
		ClassBean.getInstance().accessFlag = (int) l;
	}

}
